import { UserData } from "../../Frame/Script/const/enumConst";
import { SingletonClass } from "../../Frame/Script/core/singletonClass";

export class UserInfo extends SingletonClass<UserInfo> {

    /** id */
    public id: string = "";

    /** 房间id */
    public roomId: string = "";

    /** 昵称 */
    public name: string = "";

    /** 头像路径 */
    public avatar_url: string = "";

    /**
     * 游戏模式
     * 0: 无模式 观众
     * 1：合作模式
     * 2: 对战模式
     */
    public model: number = 0;

    /**
     * 游戏类型 
     * 0： 无类型  观众
     * 1： 简单
     * 2： 困难
     * 3： 经典
     * 4： 技能
     */
    public type: number = 0;

    /**
     * 座位位置
     * 0： 无座位  观众;
     * 1,2,3,4 对应四个座位号
     */
    public seatId: number = 0;


    protected onInit(...args: any[]) {
        this.id = "";
        this.roomId = "";
        this.name = "";
        this.avatar_url = "";
        this.model = 0;
        this.type = 0;
        this.seatId = 0;

    }

    protected onDestroy() {

    }

    public updateUserInfo(data: UserData) {
        this.id = data.id ? data.id : "";
        this.roomId = data.roomId ? data.roomId : "";
        this.name = data.name ? data.name : "";
        this.avatar_url = data.avatar_url ? data.avatar_url : "";
        this.model = data.model ? data.model : 0;
        this.type = data.type ? data.type : 0;
        this.seatId = data.seatId ? data.seatId : 0;
        // this.setTestData();
    }
}


